using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace TripleMatch
{
    public class UIManager : MonoBehaviour
    {
        private static UIManager s;
        public static UIManager S
        {
            get {
                return s;
            }
        }

        private void Awake()
        {
            s = this;
        }

        [SerializeField] GameDialogUI m_gameDialog;
        [SerializeField] GameSettlementUI m_gameSettlementDialog;
        [SerializeField] GameShopUI m_gameShopDialog;

        public void OpenGameWinUI(List<DecorationPiecesData> unSettlePieces,List<int> ids, Action<bool> finishCallback)
        {
            m_gameSettlementDialog.gameObject.SetActive(true);
            m_gameSettlementDialog.DisplaySettlement(true, unSettlePieces,ids, (b)=> {
                finishCallback?.Invoke(b);
                m_gameSettlementDialog.gameObject.SetActive(false);
            });
        }

        public void OpenGameFailUI(List<DecorationPiecesData> unSettlePieces, List<int> ids,Action<bool> finishCallback)
        {
            m_gameSettlementDialog.gameObject.SetActive(true);
            m_gameSettlementDialog.DisplaySettlement(true, unSettlePieces, ids, (b)=> {
                finishCallback?.Invoke(b);
                m_gameSettlementDialog.gameObject.SetActive(false);
            });
        }

        public void OpenGameUI()
        {
            m_gameDialog.gameObject.SetActive(true);
        }

        public void HideGameUI()
        {
            m_gameDialog.gameObject.SetActive(false);
        }

        public void RefreshGameUI(List<int> cubeList, int hideIndex = -1)
        {
            m_gameDialog.RefreshGameUI(cubeList, hideIndex);
        }

        public void OpenShopUI()
        {
            m_gameShopDialog.gameObject.SetActive(true);
            m_gameShopDialog.RefreshShopUI();
        }

        public void HideShopUI()
        {
            m_gameShopDialog.gameObject.SetActive(false);
        }

        public void SetGlobalBlockActive(bool active)
        {

        }
    }
}
